<template>
    <section class="my-salesman-main base-main">
      <div class="input-box bgcFFF text-c">
        <span class="inline-block fs14">
          <i class="iconfont iconsousuo1 fs13"></i>
          搜索销售员
        </span>
      </div>
      <div class="title fs16 color45454D pdlr15">
        待审核销售员 <i class="iconfont icongengduox fs14 flr"></i>
      </div>
      <AalesmanList
        :data="authstrData"
        :type="1"
        :showNum="2"
        @handleAgress="handleAgress"
        @handleRefuse="handleRefuse"
      ></AalesmanList>
      <div class="title fs16 color45454D pdlr15">
        我的销售员
      </div>
      <AalesmanList
        :data="authstrData"
        :type="2"
      ></AalesmanList>
      <div class="add-salesman pa">
        <span class="inline-block base-btn">添加销售员</span>
      </div>
    </section>
</template>

<script type="text/ecmascript-6">
  import AalesmanList from '../../components/AalesmanList.vue'


  export default {
    components:{
      AalesmanList,
    },
    data() {
      return {
        authstrData:[
          {
            id:1,
            pic:'https://p20.ssl.qhimgs3.com/dr/240_240_/t015540fc8db1807b91.jpg?t=1540843399',
            name:'张三',
            phone:'13659874254'
          },
          {
            id:2,
            pic:'https://p20.ssl.qhimgs3.com/dr/240_240_/t015540fc8db1807b91.jpg?t=1540843399',
            name:'李四',
            phone:'13659874254'
          },
          {
            id:3,
            pic:'https://p20.ssl.qhimgs3.com/dr/240_240_/t015540fc8db1807b91.jpg?t=1540843399',
            name:'王五',
            phone:'13659874254'
          },
          {
            id:4,
            pic:'https://p20.ssl.qhimgs3.com/dr/240_240_/t015540fc8db1807b91.jpg?t=1540843399',
            name:'蔡徐坤',
            phone:'13659874254'
          },
        ],//待审核销售员
      }
    },
    methods: {
      //拒绝
      handleRefuse(item){
        console.log('refuse--', item);
        this.$dialog.confirm({
          title: '删除',
          message: '确定拒绝 ' + item.name + ' 的申请吗？'
        }).then(() => {
          this.$ajax({
            url:api.delCart,
            method:'post'
          },{
            ids:JSON.stringify(this.resultList).replace(/\[|]/g,'')
          }).then(res => {
//            for (var i = 0,len = this.cartList.length; i < len; i++) {
//              for (var j = 0,len2 = this.resultList.length; j < len2; j++) {
//                if(this.cartList[i].id == this.resultList[j]){
//                  this.cartList.splice(i,1)
//                }
//              }
//            }
//            this.cart_info = true
//
//            this.$toast(res.data.content.msg)
          })
        }).catch(() => {
        });
      },
      //同意
      handleAgress(item){
        console.log('agree--', item);
        this.$dialog.confirm({
          title: '同意',
          message: '确定同意 ' + item.name + ' 的申请吗？'
        }).then(() => {
          this.$ajax({
            url:api.delCart,
            method:'post'
          },{
            ids:JSON.stringify(this.resultList).replace(/\[|]/g,'')
          }).then(res => {
//            for (var i = 0,len = this.cartList.length; i < len; i++) {
//              for (var j = 0,len2 = this.resultList.length; j < len2; j++) {
//                if(this.cartList[i].id == this.resultList[j]){
//                  this.cartList.splice(i,1)
//                }
//              }
//            }
//            this.cart_info = true
//
//            this.$toast(res.data.content.msg)
          })
        }).catch(() => {
        });
      },
    },
  }
</script>

<style scoped lang="scss">
  @import '../../assets/css/mySalesman.scss';
</style>
